package org.chen.ctrip.respones;

import lombok.Data;
import org.chen.common.upload.BackgroundResource;

import java.util.ArrayList;
import java.util.List;

@Data
public class UploadResponse {
    private List<BackgroundResource> result = new ArrayList<>();
    private String errorMessage;

    public static UploadResponse success(List<BackgroundResource> resources) {
        UploadResponse uploadResponse = new UploadResponse();// 创建新的实例
        uploadResponse.result = resources;
        uploadResponse.errorMessage = null; // 清除错误信息
        return uploadResponse;
    }

    public static UploadResponse fail(String errorMessage) {
        UploadResponse uploadResponse = new UploadResponse();// 创建新的实例
        uploadResponse.errorMessage = errorMessage;
        uploadResponse.result = new ArrayList<>(); // 清除结果
        return uploadResponse;
    }
}
